<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	// 实现银行卡号每隔四位加一个空格， 例如：6222023100014763381 -->6222 0231 0001 4763 381
	function formatBankCardNumber(number){
		const str = number.toString()
		const strLength = str.length
		let result = []
		let lastIndex = Math.ceil(strLength / 4)
		for(let i = 0; i < lastIndex;i++){
			const data = str.slice(i * 4,i * 4 + 4)
			result.push(data)
		}
		return result.join(' ')
	}
	
	// console.log(formatBankCardNumber("6222023100014763381"))
	console.log(formatBankCardNumber(6222023100014763381n))
</script>
</html>